package base;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class 不可变集合 {
    public static void main(String[] args) {
        //不可变集合之Map
        HashMap<String,String> hm = new HashMap<>();
        hm.put("linxin","18");

//        Set<Map.Entry<String, String>> entries = hm.entrySet();
//        Map.Entry[] array = entries.toArray(new Map.Entry[0]);
//        Map map = Map.ofEntries(array);
//        System.out.println(map);

        //hm.entrySet().toArray(new Map.Entry[0]);
        Map map = Map.ofEntries(hm.entrySet().toArray(new Map.Entry[0]));

    }
}
